package com.neo.debade.util;

import java.util.Random;

public class RandomUtil {

	public static String randomStr(int len) {
		StringBuilder buf = new StringBuilder(len);
		int index = 0;
		while(index ++ < len) {
			buf.append(randomChar());
		}
		return buf.toString();
	}
	
	private static char randomChar() {
		Random random = new Random();
		int index = random.nextInt(SEEDS_LEN);
		return SEEDS[index];
	}
	
	//LEN = 10 + 26 + 26 = 62
	/*private static final char[] SEEDS = new char[]{
		'0','1','2','3','4','5','6','7','8','9',
		'a','b','c','d','e','f','g','h','i','j',
		'k','l','m','n','o','p','q','r','s','t',
		'u','v','w','x','y','z','A','B','C','D',
		'E','F','G','H','I','J','K','L','M','N',
		'O','P','Q','R','S','T','U','V','W','X',
		'Y','Z'
	};*/
	private static final char[] SEEDS = new char[]{
		'0','1','2','3','4','5','6','7','8','9'
	};
	
	private static final int SEEDS_LEN = SEEDS.length;
	
	
	public static void main(String[] args) {
		System.out.println(randomStr(10));	
	}
}
